package top.lyjwn.ajui;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import com.xuexiang.xui.widget.picker.widget.TimePickerView;
import com.xuexiang.xui.widget.picker.widget.builder.TimePickerBuilder;
import com.xuexiang.xui.widget.picker.widget.configure.TimePickerType;
import com.xuexiang.xui.widget.picker.widget.listener.OnTimeSelectChangeListener;
import com.xuexiang.xui.widget.picker.widget.listener.OnTimeSelectListener;
import com.xuexiang.xutil.data.DateUtils;

import java.util.Calendar;
import java.util.Date;

import okhttp3.Request;
import top.lyjwn.ajui.activity.ChatListActivity;
import top.lyjwn.ajui.activity.LoginActivity;
import top.lyjwn.ajui.base.BaseActivity;
import top.lyjwn.ajui.listener.IWebSocketListener;
import top.lyjwn.ajui.network.HttpUtil;
import top.lyjwn.ajui.test.ChatListAdapter;
import top.lyjwn.ajui.test.UserUtil;
import top.lyjwn.ajui.util.DateUtil;
import top.lyjwn.ajui.util.ToastUtil;
import top.lyjwn.ajui.util.UrlUtil;
import top.lyjwn.ajui.widget.list.ListView;

public class MainActivity extends BaseActivity {

//    private final ExecutorService executor = new ThreadPoolExecutor(1, 2, 5, TimeUnit.SECONDS, new LinkedTransferQueue<Runnable>());

    private Button go_login;

    private Button go_chat;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        go_chat = findViewById(R.id.go_chat);
        go_chat.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (UserUtil.getUser()!=null){
                    Intent intent = new Intent(getContext(), ChatListActivity.class);
                    startActivity(intent);
                }else{
                    Intent intent = new Intent(getContext(), LoginActivity.class);
                    startActivity(intent);
                }

            }
        });
        go_login = findViewById(R.id.go_login);
        go_login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getContext(), LoginActivity.class);
                startActivity(intent);
            }
        });
    }


    @Override
    protected int getLayoutId() {
        return R.layout.activity_main;
    }
}
